﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using TERP.WaterClient.Views;
using TERP.WaterClient.Common;
using TERP.WaterClient.DbServices;
using TERP.WaterClient.Report;
using DevExpress.Utils;
using DevExpress.Data;


namespace TERP.WaterClient.Report
{
    public partial class FrmReportShow : FrmMdiBase
    {
        #region 

        //gb
        public string strStringAmount = string.Empty;

        //Source
        public string strReportView = string.Empty;
        public DataTable dtDataSource = null;
        public DataSet dsSource = null;

        //Header
        private string strCompanyName = "Sở kế hoạch && Đầu tư tỉnh Bắc Giang";
        private string strCompanyAddress = "CÔNG TY THHH MTV DU LỊCH BÌNH DƯƠNG";//"Showroom 1: Do Lộ, Yên Nghĩa, Hà Đông, Hà Nội - Tel: (043)353 5455";
        private string strCompanyAddress1 = string.Empty;// "Showroom 2: Số 121 Thái Hà, Đống Đa, Hà Nội - Tel: (043) 537 9870";
        private string strCompanyTel =  string.Empty;//"Website: http://hyundaihadong.com.vn";

        //Quotation
        public string strCusName = string.Empty;
        public string strAddress = string.Empty;
        public string strTel = string.Empty;
        public string strTaxCode = string.Empty;
        public string strPlateNo = string.Empty;
        public string strModel = string.Empty;
        public string strFrameNo = string.Empty;
        public string strEngineNo = string.Empty;
        public string strProductYear = string.Empty;
        public string strColorCode = string.Empty;
        public string strKm = string.Empty;
        public string strCusRequest = string.Empty;
        public string strCarStatus = string.Empty;
        public string strTradeMarkName = string.Empty;
        public string strCheckInDate = string.Empty;
        public string strPlanedDeliveryDate = string.Empty;        

        public string strRONo = string.Empty;
        public string strVAT = string.Empty;
        public string strAffterVAT = string.Empty;
        public string strSumBefVAT = string.Empty;

        //Giay Ra Cong
        public string strDealerName = "HYUNDAI HÀ ĐÔNG";   
     
        //Invoice
        public string strSumAmount= string.Empty;

        public string strFromDateToDate = string.Empty;


        //Total_Stock_RepairOrder
        public string strCusFax = string.Empty;
        public string strCusTel = string.Empty;
        public string strContractNo = "- Hyundai - San SLX 2.0 CRDi 2WD";
        public string strModelName = string.Empty;

        #endregion

        public FrmReportShow()
        {
            InitializeComponent();
        }


        public FrmReportShow(
            DataTable _dtSource,
            string _strReportView,
            string _strFromDateToDate
            )
        {
            InitializeComponent();
            this.dtDataSource = _dtSource;
            this.strReportView = _strReportView;
            this.strFromDateToDate = _strFromDateToDate;
        }

        private void FrmReportShow_Load(object sender, EventArgs e)
        {
            switch (strReportView)
            {
                #region StockRequisition
                case ReportView.RptView_Water_ChungTuGhiSo:
                    {
                        rptWaterChungTuGhiSo _rptPhieu = new rptWaterChungTuGhiSo();
                        _rptPhieu.SetDataSource(dtDataSource);
                        _rptPhieu.SetParameterValue("strCompanyName", strCompanyName);
                        _rptPhieu.SetParameterValue("strCompanyAddress", strCompanyAddress);
                        //_rptPhieu.SetParameterValue("strCompanyAddress1", strCompanyAddress1);
                        //_rptPhieu.SetParameterValue("strCompanyTel", strCompanyTel);

                        _rptPhieu.SetParameterValue("strFromDateToDate", strFromDateToDate);
                        crystalReportViewer1.ReportSource = _rptPhieu;
                    }
                    break;
                #endregion

                #region OutGate
                case ReportView.RptView_Water_TotalStockOut:
                    {
                        rptWaterTotalStockOut _rptPhieu = new rptWaterTotalStockOut();
                        _rptPhieu.SetDataSource(dtDataSource);
                        _rptPhieu.SetParameterValue("strCompanyName", strCompanyName);
                        _rptPhieu.SetParameterValue("strCompanyAddress", strCompanyAddress);
                        //_rptPhieu.SetParameterValue("strCompanyAddress1", strCompanyAddress1);
                        //_rptPhieu.SetParameterValue("strCompanyTel", strCompanyTel);

                        _rptPhieu.SetParameterValue("strFromDateToDate", strFromDateToDate);
                        crystalReportViewer1.ReportSource = _rptPhieu;
                    }
                    break;
                #endregion
                default:
                    break;
            }
        }
    }
}